﻿namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Truck : Vehicle
    {
        private const int k_NumOfWheels = 8;
        private const int k_MaxAirPressure = 27;
        private const int k_FuelMotorCapacity = 150;
        private float m_VolumeCapacity;
        private bool m_HasDangerousMaterials;

        public Truck()
            : base(k_NumOfWheels, k_MaxAirPressure)
        {
            this.m_EnergySource = new Fueled(EnergySource.eEnergySourceType.Soler);
            this.m_EnergySource.MaxEnergyCapacity = k_FuelMotorCapacity;
        }

        public override void UpdateVehicleDetails(List<string> i_VehicleDetails)
        {
            base.UpdateVehicleDetails(i_VehicleDetails);
            this.m_VolumeCapacity = float.Parse(i_VehicleDetails[5]);
            this.m_HasDangerousMaterials = bool.Parse(i_VehicleDetails[6]);
        }

        public override List<string> ReturnSpecialFeatures()
        {
            List<string> featuresToReturn = new List<string>();
            featuresToReturn.Add("volume capacity");
            featuresToReturn.Add("whether or not the truck contains dangerous materials (True/False)");

            return featuresToReturn;
        }

        public override StringBuilder GetSpecialDataPrint()
        {
            StringBuilder specialDetails = new StringBuilder();

            specialDetails.Append("the truck's capacity volume type is: " + this.m_VolumeCapacity.ToString() + System.Environment.NewLine);
            if (this.m_HasDangerousMaterials)
            {
                specialDetails.Append("the truck contains dangerous materials " + System.Environment.NewLine);
            }
            else
            {
                specialDetails.Append("the truck doesn't contain dangerous materials " + System.Environment.NewLine);
            }

            return specialDetails;
        }
    }
}
